package com.cicadamob.contact.api.Utils;

import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.widget.SearchView;
import android.widget.TextView;


/**
 * @author yeyue
 *  14-9-15
 */
public class ThemeUtility {


    public static int getColor(Activity activity, int attr) {
        int[] attrs = new int[]{attr};
        TypedArray ta = activity.obtainStyledAttributes(attrs);
        int color = ta.getColor(0, 430);
        ta.recycle();
        return color;
    }

    public static Drawable getDrawable(int attr) {
        int[] attrs = new int[]{attr};
        Context context = ContactConfig.getContext();
        TypedArray ta = context.obtainStyledAttributes(attrs);
        Drawable drawable = ta.getDrawable(0);
        ta.recycle();
        return drawable;

    }

    public static int getResourceId(int attr) {
        int[] attrs = new int[]{attr};
        Context context = ContactConfig.getContext();
        TypedArray ta = context.obtainStyledAttributes(attrs);
        int id = ta.getResourceId(0, 430);
        ta.recycle();
        return id;
    }

    public static int getDimensionPixelSize(Activity activity, int attr, int defaultValue) {
        int[] attrs = new int[]{attr};
        TypedArray ta = activity.obtainStyledAttributes(attrs);
        int value = ta.getDimensionPixelSize(0, defaultValue);
        ta.recycle();
        return value;
    }


    //android:actionModeShareDrawalbe is not a public attr
    public static int getActionBarShareItemIcon() {
		return 0;
    	
    }

}
